import request from "@/utils/request.ts"

// 导入ts类型
import { loginParams } from "@/api/user/type.ts"

// 枚举相对于的api
enum Api {
    Login_url = "/admin/acl/index/login",
    UserInfo_url = "/admin/acl/index/info",
    Logout_url = "/admin/acl/index/logout",
}

// 登录接口
export const login = (data: loginParams) => {
    return request({
        method: "post",
        url: Api.Login_url,
        data: data, // post请求字段使用data
    })
}

// 登出接口
export const logout = () => {
    return request({
        method: "post",
        url: Api.Logout_url,
    })
}

// 用户信息接口
export const userInfo = (data: any) => {
    return request({
        method: "get",
        url: Api.UserInfo_url,
        params: data, // get请求字段使用params
    })
}
